import request from '@/utils/requets'
import { GetSKU, SKUData } from './type'
enum API {
    //获取已有的商品的数据-SKU
    SKU_URL = '/admin/product/list/',
    //上架
    SALE_URL = '/admin/product/onSale/',
    //下架的接口
    CANCELSALE_URL = '/admin/product/cancelSale/',
    //获取商品详情的接口
    SKUINFO_URL = '/admin/product/getSkuInfo/',
    //删除已有的商品
    DELETESKU_URL = '/admin/product/deleteSku/',
}
//获取商品SKU的接口
export const skuList = (page: number, limit: number) =>
    request.get<any, GetSKU>(API.SKU_URL + `${page}/${limit}`)
//上架
export const onSale = (skuId: number) =>
    request.get<any, any>(API.SALE_URL + skuId)
//下架的接口
export const cancelSale = (skuId: number) =>
    request.get<any, any>(API.CANCELSALE_URL + skuId)
//获取商品详情的接口
export const getSkuInfo = (skuId: number) =>
    request.get<any, SKUData>(API.SKUINFO_URL + skuId)
//删除已有的商品
export const deleteSku = (skuId: number) =>
    request.get<any, any>(API.DELETESKU_URL + skuId)
